/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.comprainsumos.modelo;

import com.comprainsumos.MPersistencia.MPInsumos;
import com.comprainsumos.MPersistencia.MProveedor;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Cristian
 */
public class InsumoProveedor {
    private int id;
    private Insumo insumos = new Insumo();
    private Proveedor provedores = new Proveedor();
    private double precio;

    public static InsumoProveedor load(ResultSet rs) throws SQLException, Exception {
        InsumoProveedor prodprov = new InsumoProveedor();
        prodprov.setId(rs.getInt(1));
        prodprov.setInsumos(MPInsumos.getInsumos(rs.getInt(2)+""));
        prodprov.setProvedores(MProveedor.getProveedor(rs.getString(3)));
        prodprov.setPrecio(rs.getDouble(4));
        return prodprov;
    }
    public InsumoProveedor(){
        
    }
    /**
     * @return the insumos
     */
    public Insumo getInsumos() {
        return insumos;
    }

    /**
     * @param insumos the insumos to set
     */
    public void setInsumos(Insumo insumos) {
        this.insumos = insumos;
    }

    /**
     * @return the provedores
     */
    public Proveedor getProvedores() {
        return provedores;
    }

    /**
     * @param provedores the provedores to set
     */
    public void setProvedores(Proveedor provedores) {
        this.provedores = provedores;
    }

    /**
     * @return the precio
     */
    public double getPrecio() {
        return precio;
    }

    /**
     * @param precio the precio to set
     */
    public void setPrecio(double precio) {
        this.precio = precio;
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * @return the precio
     */
}
